<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script src="__PUBLIC__/base/iconfont.js"></script>
<title>{$web.name} - {$web.title}</title>
{load href="__PUBLIC__/base/base.css,__PUBLIC__/manage/frame.css,__PUBLIC__/js/do.js,__PUBLIC__/admin/common.js,__PUBLIC__/js/package.js" /}
</head>
<body>
<div id="app-navbar">
    <ul>
        {if $member_miniapp_id}<a href="javascript:;" class="apps"><li><svg class="icon" aria-hidden="true"><use xlink:href="#icon-classify_icon"></use></svg><p>应用</p></li></a>
        <a href="{:url('system/passport.user/index')}" target="iframe"><li><svg class="icon white" aria-hidden="true"><use xlink:href="#icon-my_icon"></use></svg><p>会员</p></li></a>
        {else}<a href="{:url('system/passport.appshop/index')}" target="iframe"><li><svg class="icon white" aria-hidden="true"><use xlink:href="#icon-store_icon"></use></svg><p>商店</p></li></a> 
        {/if}
        {if !$user->parent_id}
        <a href="{:url('system/passport.member/staff')}" target="iframe"><li><svg class="icon white" aria-hidden="true"><use xlink:href="#icon-license"></use></svg><p>账号</p></li></a>
        <a href="{:url('system/passport.bank/bill')}" target="iframe"><li><svg class="icon white" aria-hidden="true"><use xlink:href="#icon-chuzhijine"></use></svg><p>财务</p></li></a>
        {/if} 
        <a href="{:url('system/passport.message/index')}" target="iframe"><li id="message"><svg class="icon white" aria-hidden="true"><use xlink:href="#icon-wodefankui"></use></svg><p>消息</p></li></a>
    </ul>
    <div class="user">
        <ul>
        {if $member_miniapp_id && !$user->parent_id}<a class="shortcut" tip="应用中心" href="{:url('system/passport.appshop/index')}" target="iframe"><li><svg class="icon white" aria-hidden="true"><use xlink:href="#icon-store_icon"></use></svg><p>商店</p></li></a>{/if}
    <a class="userinfo" rel="layer" href="javascript:;"><li class="focus"><svg class="icon white" aria-hidden="true"><use xlink:href="#icon-my_icon"></use></svg><p>我的</p></li></a>
        </ul>
    </div>
</div>
{if !empty($member_miniapp_id)}<div id="nav"></div>{/if}
<div id="main" style="left:{$member_miniapp_id?260:60}px"><iframe id="iframe" name="iframe" src="{$welcome}" frameborder="0"></iframe></div>
<div id="layer">
    {if !$user->parent_id}<div class="item divider"><a href="{:url('system/passport.bank/index')}" target="iframe"><i class="iconfont icon-chuzhijine"></i> 财务管理</a></div>
    <div class="item"><a href="{:url('system/passport.member/index')}" target="iframe"><i class="iconfont icon-credentials_icon"></i> 个人资料</a></div>
    {/if}
    <div class="item divider password fn-cp" url="{:url('system/passport.index/password')}"><i class="iconfont icon-xiugaidenglumima"></i> 修改密码</div>
    <div class="item"><a href="{:url('system/passport.login/logout')}" target="main"><i class="iconfont icon-shutdown_icon"></i> 退出管理</a></div>
</div>
<div id="tip">
    <a href="//www.sapixx.com/docs.html" target="_blank"><svg class="icon fn-f20" aria-hidden="true"><use xlink:href="#icon-help"></use></svg></a>
    <a href="//www.sapixx.com" target="_blank"><svg class="icon fn-f20" aria-hidden="true"><use xlink:href="#icon-home_icon"></use></svg></a>
</div>
<div class="leftlayer" id="applayer" class="fn-hide">
    <div class="title">
        <span>我的应用</span>
        <span class="iconfont icon-cuowu closeLayer"></span>
    </div>
    <div class="bodys">
        {volist name="apps" id="rs"}
        <a href="javascript:;" class="{$rs.is_lock?'manageLock':'manageApp'}" url="{:url('system/passport.index/changeApp',['id'=>$rs.id])}">
            <img src="{$rs.logo}"><p>{$rs.appname}</p>
        </a>
        {/volist}
    </div>
</div>
<script id="navtpl" type="text/html">
<h1>
    <svg class="icon" aria-hidden="true"><use xlink:href="#icon-pre_icon_xiaochengxu"></use></svg>
    <a href="{:url('system/passport.setting/index')}" target="iframe">{if empty($appname)}应用中心{else}{$appname}{/if}</a>
</h1>
{literal}
{{each list value}}
<dl><dt><i class="iconfont icon-{{value.icon}}"></i><i class="iconfont icon-arrowright"></i>{{value.name}}</dt>
    {{each value.nav rs}}<dd><a href="{{rs.url}}" target="iframe">{{if rs.icon}}<i class="iconfont icon-{{rs.icon}}"></i>{{else}}<i class="iconfont icon-arrowright"></i>{{/if}}{{rs.name}}</a></dd>{{/each}}
</dl>
{{/each}}
{/literal}
</script>
<script type="text/javascript">
Do('base','layer','tip','tpl',function(){
    nav({$member_miniapp_id},"{:url('system/passport.index/appmenu')}")
    $(".miniapp").click(function(){
        nav($(this).attr("id"),"{:url('system/passport.index/appmenu')}");
    });
    $(".password").click(function(){
        win_reload($('.password').attr('url'),['600px','350px']);
    });
    $(".apps").click(function(){
        var index = layer.open({type: 1,content:$('#applayer'),title:false,closeBtn:false,shadeClose:true,area: ['320px','100%'],shade: 0.1,offset: ['0', '60px']});
        $(".closeLayer").click(function(){
            parent.layer.close(index);
        });
    });
    //切换管理
    $('.manageApp').click(function(){
        var url = $(this).attr('url');
        var index = parent.layer.load(0,{shade:[0.3,'#393D49']});
        $.getJSON(url,function(data){
            parent.layer.close(index);
            if(data.code == 200){
                window.parent.location.href = data.url;
            }else{
                parent.layer.alert(data.message,{icon:5})
            };
        }); 
    });
    //锁定提示
    $('.manageLock').click(function(){
        parent.layer.alert('当前应用已被锁定,禁止管理',{icon:5})
    });
    $(".shortcut").powerFloat({offsets:{x:0,y:5},showDelay: 100,hoverHold: false,targetMode: "remind",targetAttr: "tip",position: "2-1"});
    $(".userinfo").powerFloat({eventType:"hover",targetMode:'common',targetAttr:"rel",position:"3-4"});
    //定时访问
    setInterval(function(){
        $.ajax({
            url:"{:url('system/passport.message/count')}",
            success:function(req){
                if(req.data > 0){
                    layer.tips('您有一条新的信息', '#message', {tips: [2, '#f4615c']});
                }
            }
        });
    },10000);
});
function nav(app,url) {
    $(".app").click(function () {$(".app").removeClass("focus");$(this).addClass("focus");});
    $.getJSON(url,{id: app},function (data) {
        $("#nav").html(template('navtpl',{list:data}));
        $("#nav dd").hide();
        $("#nav dl:first").find('dd').show();
        $("#nav dt").click(function(){
            $("#nav dd").hide("fast");
            $(this).parent().find('dd').slideToggle('fast');
        });
        $("dd").click(function (){
            $("dd").removeClass("focus");
            $(this).addClass('focus')
            $(this).find('.right-icon').removeClass('icon-arrowright');
            $(this).find('.right-icon').addClass('icon-arrowdown');   
        ;});
    });
}
</script>
</body>
</html>